import { ApiProperty } from '@nestjs/swagger'
import { IsNumber, IsOptional, IsString, IsUrl, Min } from 'class-validator'

export class CreateBookDto {
  @ApiProperty({ description: '书籍标签ID' })
  @IsNumber()
  bookTagId: number

  @ApiProperty({ description: '书籍名称' })
  @IsString()
  bookName: string

  @ApiProperty({ description: '书本pdf链接' })
  @IsUrl()
  bookUrl: string

  @ApiProperty({ description: '书本封面' })
  @IsUrl()
  bookCover: string

  @ApiProperty({ description: '学级，0 幼儿园，1-6 小学，7-8 初中', required: false })
  @IsNumber()
  @Min(0)
  bookGrade: number

  @ApiProperty({ description: '书本音频文件', required: false })
  @IsString()
  @IsOptional()
  bookAudioUrls: string

  @ApiProperty({ description: '书籍描述', required: false })
  @IsString()
  @IsOptional()
  bookSplitContent?: string

  @ApiProperty({ description: '音频切割类型，1 人工字幕 2 AI字幕', required: false })
  @IsNumber()
  @IsOptional()
  bookSplitType?: number
}
